package thread;

public class CurrentThreadDemo {
    public static void main(String[] args) {
        //主线程执行main方法进来后会执行下面这句代码，此方法返回的就是主线程
       Thread main = Thread.currentThread();
       System.out.println("主线程:" + main);
       dosome();
        System.out.println("主程序执行完main方法后就结束了");
    }

    public static void dosome(){
        //获取调用dosome方法的线程
        Thread t = Thread.currentThread();
        System.out.println("调用dosome方法的线程是:" + t);
    }
}
